<%@ taglib uri="struts-html" prefix="html" %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="struts-bean" prefix="bean" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<jsp:include page="../common/top.jsp"/>

<script type='text/javascript' src='common.js'></script>
		<script type='text/javascript' src='css.js'></script>
		<script type='text/javascript' src='standardista-table-sorting.js'>
</script>
<logic:messagesPresent message="true">
	<br>
	<div class="error"><div><div><div><div><div><div><div>
   		<html:messages id="msg" message="true">
			<table  class="errorTable">
				<tr>
					<td> <bean:write name="msg"/></td>
				<tr>	
			</table>
   		</html:messages>
		</div></div></div></div></div></div></div></div>
</logic:messagesPresent>
<html:form action="/struts/search/searchRegistrantsAction">
<table class="defaultSearch" id="defaultSearch">
	<tr>
		<td>Last name</td>
		<td><html:text property="lastName" styleClass="inputValue" errorStyleClass="errorInput"/></td>
		<td>Pre-reg code</td>
		<td><html:text property="preRegCode" styleClass="inputValue" errorStyleClass="errorInput"/></td>
		<td><html:submit value="Search"/></td>
		<td>&nbsp;</td>
		<td>Advanced Search</td>
		<td class="pointerhand"><img src="../../img/searchArrow.gif"  onclick="javascript:showSearchOptions();"></td>
	</tr>
</table>

<table class="searchStyleHidden" id="searchBoxLabel">
	<tr>
		<td>Advanced Search</td>
	</tr>
</table>
<table class="searchStyleHidden" width="100%"  id="searchBox" cellpadding="2" align="center" cellspacing="0" border=0>
	
	<tr class="searchOptionsTable">
		<td class="searchBubble tl" width="1px"></td>
		<td class="searchBubble" valign="top" align="right"><img class="pointerhand" src="../../img/close.gif" onclick="javascript:hideSearchOptions();"></td>
		<td class="searchBubble tr" width="1px" ></td>
	</tr>
	<tr>
		<td class="searchBubble"></td>
		<td class="searchBubble">
			<table class="innerSearchBubble" width="100%" >
				<tr>
					<td>First name</td>
					<td><html:text property="firstName" styleClass="inputValue" errorStyleClass="errorInput"/></td>
					<td>Country</td>
					<td><html:select property="countryCodeCountryId" styleClass="inputValue" errorStyleClass="errorInput">
							<html:option value="0">Please Select</html:option>
							<html:options collection="countries" property="countryId" labelProperty="countryIsoCode"/>
						</html:select></td>
					<td>Accomodation</td>
					<td><html:select property="accomodationTypeId" styleClass="inputValue" errorStyleClass="errorInput">
							<html:option value="0">Please Select</html:option>
							<html:options collection="accomodationTypes" property="accomodationTypeId" labelProperty="accomodationDesc"/>
						</html:select></td>
				</tr>
				<tr>
					<td>Last name</td>
					<td><html:text property="advLastName" styleClass="inputValue" errorStyleClass="errorInput"/></td>
					<td>Registration type</td>
					<td><html:select property="registrantTypeId" styleId="regTypeCombo" styleClass="inputValue">
							<html:option value="0">Please Select</html:option>
							<html:options collection="registrantTypes" property="registrantTypeId" labelProperty="registrantTypeDesc"/>
						</html:select></td>
						<td>Status</td>
							<td>
                                  <html:select property="statusId" styleId="regTypeCombo" styleClass="inputValue">
	                                  <html:option value="0">Please Select</html:option>
	  								  <html:option value="1">OnSite</html:option>
	                                 <html:option value="2">Pending Arrival</html:option>
  								   </html:select>
                           </td>
				</tr>
				<tr>
					<td>Pre-reg code</td>
					<td><html:text property="advPreRegCode" styleClass="inputValue" errorStyleClass="errorInput"/></td>
					<td>Length of stay</td>
					<td><html:select property="lengthOfStay" styleClass="inputValue" errorStyleClass="errorInput">
							<html:option value="0">Please Select</html:option>
							<html:option value="1">1</html:option>
							<html:option value="2">2</html:option>
							<html:option value="3">3</html:option>
							<html:option value="4">4</html:option>
							<html:option value="5">5</html:option>
							<html:option value="6">6</html:option>
							<html:option value="7">7</html:option>
						</html:select></td>
					<td>Pre-reg</td>
					<td><html:checkbox property="preRegistration"/></td>
				</tr>
					<tr>
				     <td>Notes</td>
				     <td colspan="5">
                       <html:text property="notes" styleClass="inputValue" errorStyleClass="errorInput"/>
                     </td>
				</tr>
				
				
				<html:hidden property="advancedSearch" styleId="advancedSearch"/>
				<tr>
					<td>&nbsp;</td>
					<td>&nbsp;</td>
					<td align="right"><html:submit value="Search"/>
					<input type="hidden" name="methodToCall" value="searchGuests" />
					</td>
				</tr>
			</table>
		</td>
		<td class="searchBubble"></td>
	</tr>
	<tr>
		<td class="searchBubble bl"></td>
		<td class="searchBubble"></td>
		<td class="searchBubble br"></td>
	</tr>	
</table>

<br>
<c:set var="currentAction" scope="session" value="/struts/search/searchRegistrantsAction.do"/>
<c:set var="nextMethod" scope="session" value="searchNext"/>
<c:set var="previousMethod" scope="session" value="searchPrevious"/>
<jsp:include page="../common/paging.jsp"/>

<table cellpadding="0"  cellspacing="0" border=0 width="100%" height="100%" >
        <tbody>
		<tr>
			<td class="sbubble tls" width="24px" height="25px"></td>
			<td  class="sbubble t">&nbsp;</td>
			 <td class="sbubble trs" ></td>
		</tr>
		<tr>
		<td class="sbubble l">&nbsp;</td>
			<td class="sbubble" rowspan="1" align="center" width="95.1%">
				<display:table name="listOfRegs"   defaultsort="1" defaultorder="descending" width="100%" id="searchTable">
				<display:setProperty name="css.table" value="searchTable" />
				<display:setProperty name="basic.empty.showtable" value="true" />
				<display:column property="registrant.firstName" title="First Name"  href="/ejc/struts/register/registrationUpdateAction.do?methodToCall=preUpdate" paramId="registrantId"  paramProperty="registrantId"  headerClass="sortable" />
				<display:column property="registrant.lastName" title="Last Name" href="/ejc/struts/register/registrationUpdateAction.do?methodToCall=preUpdate" paramId="registrantId"  paramProperty="registrantId" headerClass="sortable"/>
				<display:column property="registrant.email" title="Email" headerClass="sortable" />
				<display:column property="registrantType.registrantTypeDesc" title="Registrant Type"  headerClass="sortable" />
				<display:column property="registrantStatusType.statusDesc" title="Status" headerClass="sortable" />
			  </display:table>
			</td>
			<td class="sbubble r">&nbsp;</td>
	 </tr>
	 <tr>
		<td class="sbubble bls" width="24px" height="25px"></td>
		<td class="sbubble b">&nbsp;</td>
		<td class="sbubble brs"></td>
	  </tr>
	  </tbody>
	 </table>
	 <jsp:include page="../common/paging.jsp"/>
</html:form>

<jsp:include page="../common/bottom.jsp" />

<script language="JavaScript" type="text/JavaScript">
<!--
	if(${requestScope.advancedSearch}){
		showSearchOptions();
	};

	function showSearchOptions()
	{
		var searchBox = document.getElementById('searchBox');
		var searchBoxLabel = document.getElementById('searchBoxLabel');
		searchBox.className = 'searchStyleVisible';	
		searchBoxLabel.className = 'searchBoxLabel';
		var defaultSearch = document.getElementById('defaultSearch');
		defaultSearch.className = 'searchStyleHidden';
		var advancedSearch = document.getElementById('advancedSearch');
		advancedSearch.value = 'true';
		document.searchRegistrantsForm.firstName.focus();
	}

	function hideSearchOptions()
	{
		var searchBox = document.getElementById('searchBox');
		searchBox.className = 'searchStyleHidden';	
		var searchBoxLabel = document.getElementById('searchBoxLabel');
		searchBoxLabel.className = 'searchStyleHidden';
		var defaultSearch = document.getElementById('defaultSearch');
		defaultSearch.className = 'defaultSearch';
		var advancedSearch = document.getElementById('advancedSearch');
		advancedSearch.value = 'false';
		document.searchRegistrantsForm.lastName.focus();
	}
	
	/*
	* Modify the style class of the search table results. This is needed so that we can have 
	* a table sort feature.
	*/
    var table = document.getElementById('searchTable');
	table.className = "searchTable sortabled";

	//Set the onLoad function here
	document.searchRegistrantsForm.lastName.focus();
//-->
</script>